<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>vaeThink</title>
    {include file="../common/header"}
</head>
<body class="vae-body">

<div class="vae-content">
    <form class="layui-form" style="display: inline;">
        <input type="text" name="keywords" required  lay-verify="required" placeholder="ID/名称/描述" class="layui-input" autocomplete="off" style="max-width: 200px;display: inline;margin: -10px 10px 0 0;height: 30px;" />
        <button class="layui-btn layui-btn-sm layui-btn-danger" lay-submit="" lay-filter="vaeform">提交搜索</button>
    </form>
    <table class="layui-hide" id="list" lay-filter="test">


    </table>
</div>






{include file="../common/footer"}
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-xs layui-btn-primary" href="/voip/airlines_auth/useredit/id/{{d.id}}">编辑</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
<script type="text/html" id="toolbarDemo">
    <div class="layui-btn-container">
        <a class="layui-btn layui-btn-primary layui-btn-sm" href="/voip/airlines_auth/userAdd">添加客服</a>
    </div>
</script>
<script type="text/html" id="status">
    <i class="layui-icon {{#  if(d.status == 1){ }}layui-icon-ok{{#  } else { }}layui-icon-close{{#  } }}"></i>
</script>
<script>
    layui.config({
        base: '/themes/admin_themes/module/'
    }).use(['table','vaeyo','form'], function(){
        var table = layui.table
            ,vae = layui.vaeyo
            ,$ = layui.$
            ,form = layui.form;

        var tableIns = table.render({
            elem: '#list'
            ,toolbar: '#toolbarDemo'
            ,url: "{:url('AirlinesAuth/userExcelList')}" //数据接口
            ,page: true //开启分页
            ,limit: 15
            ,cols: [[ //表头
                {field: 'id', title: '序号', sort: true, fixed: 'left', align:'center', width:80}
                ,{field: 'username', title: '客服名字', align:'center'}
                ,{field: 'title', title: '权限组', align:'center'}
                ,{field: 'update_time', title:'更新时间',  align:'center'}
                ,{field: 'create_time', title:'创建时间',  align:'center'}
                ,{field: 'status', title:'状态', toolbar: '#status', align:'center', width:100}
                ,{field: 'right', toolbar: '#barDemo', width:150, align:'center'}
            ]]
        });

        //监听行工具事件
        table.on('tool(test)', function(obj){
            var data = obj.data;
            //console.log(obj)
            if(obj.event === 'del'){
                layer.confirm('真的删除行么', {icon: 3, title:'提示'}, function(index){
                    $.ajax({
                        url:"/admin/admin/delete",
                        data:{id:data.id},
                        success:function(res){
                            layer.msg(res.msg);
                            if(res.code==1){
                                obj.del();
                            }
                        }
                    })
                    layer.close(index);
                });
            }
        });

        //监听搜索提交
        form.on('submit(vaeform)', function(data){
            console.log(data.field.keywords)
            if(data.field.keywords) {
                tableIns.reload({where:{keywords:data.field.keywords}});
                vae.bundledTab();
            }
            return false;
        });
    });
</script>

</body>
</html>